package cn.hloger.spider.demo.newsDemo.controller.h5;

import cn.hloger.spider.demo.newsDemo.handler.news.EmojiHandler;
import cn.hloger.spider.demo.newsDemo.service.NewsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * TODO
 *
 * @author huanglong
 * @Description TODO
 * @data 2022/9/12
 */
@Controller
@RequestMapping("h5/news")
public class NewsH5Controller {
    @Autowired
    private NewsApiService newsApiService;

    @RequestMapping(value = "/view")
    public ModelAndView view() {
        ModelAndView index = new ModelAndView("news");
        String view = newsApiService.view(null);
        index.addObject("news", view);
        index.addObject("emojiUrl", EmojiHandler.getEmojiUrl());
        return index;
    }

    @RequestMapping(value = "/baozi")
    public ModelAndView baozi() {
        ModelAndView index = new ModelAndView("news");
        return index;
    }

    @RequestMapping(value = "/fang")
    public ModelAndView fang() {
        ModelAndView index = new ModelAndView("news");
        String view = newsApiService.baozi(null);
        index.addObject("news", view);
        index.addObject("emojiUrl", EmojiHandler.getEmojiUrl());
        return index;
    }
}
